﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class ygregister : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
   
    protected void btnSubmit1_Click(object sender, EventArgs e)
{
    string num = txtNum1.Text.Trim();
    string pw = txtPw1.Text.Trim();
    string idcard = txtIdcard1.Text.Trim();
    string name = txtName1.Text.Trim();
    string phone = txtPhone1.Text.Trim();
    staff tmp = new staff();
    tmp.num = num;
    tmp.pw = pw;
    tmp.idcard = idcard;
    tmp.name = name;
    tmp.phone = phone;
    int result = tmp.Addonestaff(tmp);
    if (result > 0)
    {
        Response.Write("<script>alert(\"恭喜你注册成功！\")</script>");
    }
    else
    {
        Response.Write("<script>alert(\"对不起，你注册失败！\")</script>");
    }
}
    protected void btnSearch_Click(object sender, EventArgs e)
    {
        string num = txtNum1.Text.Trim();
        staff us = new staff();
        us.num = num;//传递给us
        int result = us.IsidExist(us);
        if (result > 0)
        {
            lblMsg1.Visible = true;
            lblMsg1.Text = "这个账号已经存在！";
            btnSubmit1.Enabled = false;
        }
        else
        {
            lblMsg1.Visible = true;
            lblMsg1.Text = "这个账号可用！";
            btnSubmit1.Enabled = true;
        }
    }
}
